import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Logger {
	private static final String LOG_FILE_FOLDER = "logs";
	private static final String LOG_FILE_NAME = "log.txt";

	private Logger() {
	}

	public static void log(MsgType type, String extraInfo) {
		String msg = "";
		msg = getDate()+"\t" + type.toString()+"\t" + extraInfo+"\n";
		FileUtils.appendToFile(getLogFile(), msg);
	}

	private static String getLogFile() {
		return LOG_FILE_FOLDER + "\\" + getDateNoSec() + LOG_FILE_NAME;
	}

	private static String getDate() {
		DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss ");
		Date date = new Date();
		return dateFormat.format(date);
	}
	private static String getDateNoSec() {
		DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HH ");
		Date date = new Date();
		return dateFormat.format(date);
	}
}
